#ifndef GRAPHIC_ITEM_COMMON_H
#define GRAPHIC_ITEM_COMMON_H

#include "editoritemcommon.h"

#include <QtGui/QGraphicsItem>

namespace swp
{

const int PREFERRED_THUMBNAIL_SIZE = 100;
const int PREFERRED_THUMBNAIL_PADDING = 10;
const int PREFERRED_THUMBNAIL_PEN_SIZE = 1;

const int PREFERRED_CONTENT_PADDING = 10;
const int PREFERRED_CONTENT_PADDING_SMALL = 5;
const int PREFERRED_CONTENT_ITEM_SPACING = 10;

const qreal PREFERRED_ROUNDED_CORNERS_RADIUS = 5;
const qreal PREFERRED_PEN_SIZE = 1;

const int PREFERRED_GRAVITATION_RADIUS = 15;

const int INVALID_TYPE = -1;

const int ABS_POLYGON_ITEM = QGraphicsItem::UserType + 1000;
const int ABS_ELLIPSE_ITEM = QGraphicsItem::UserType + 2000;
const int ABS_LINE_ITEM = QGraphicsItem::UserType + 3000;
const int ENTITY_ITEM = QGraphicsItem::UserType + 4000;
const int CONNECTOR_ITEM = QGraphicsItem::UserType + 5000;
const int CONNECTOR_HANDLE_ITEM = QGraphicsItem::UserType + 6000;
const int ABS_RECT_ITEM = QGraphicsItem::UserType + 7000;

const int SWP_ACTIVITY_ITEM = ABS_RECT_ITEM + 1;
const int SWP_DECISION_ITEM = ABS_POLYGON_ITEM + 2;
const int SWP_SWIMLANE_ITEM = ABS_POLYGON_ITEM + 3;
const int SWP_JOIN_ITEM = ABS_POLYGON_ITEM + 4;
const int SWP_SPLIT_ITEM = ABS_POLYGON_ITEM + 5;

const int SWP_SIM_ACTIVITY_ITEM = ABS_POLYGON_ITEM + 6;
const int SWP_SIM_DECISION_ITEM = ABS_POLYGON_ITEM + 7;
const int SWP_SIM_SWIMLANE_ITEM = ABS_POLYGON_ITEM + 8;
const int SWP_SIM_JOIN_ITEM = ABS_POLYGON_ITEM + 9;
const int SWP_SIM_SPLIT_ITEM = ABS_POLYGON_ITEM + 10;

const int SWP_MERGE_ITEM = ABS_POLYGON_ITEM + 11;
const int SWP_I_EVENT_ITEM = ABS_POLYGON_ITEM + 12;
const int SWP_O_EVENT_ITEM = ABS_POLYGON_ITEM + 13;
const int SWP_INTER_REGION_ITEM = ABS_POLYGON_ITEM + 14;

const int SWP_SIM_MERGE_ITEM = ABS_POLYGON_ITEM + 15;
const int SWP_SIM_I_EVENT_ITEM = ABS_POLYGON_ITEM + 16;
const int SWP_SIM_O_EVENT_ITEM = ABS_POLYGON_ITEM + 17;
const int SWP_SIM_INTER_REGION_ITEM = ABS_POLYGON_ITEM + 18;

const int SWP_START_POINT_ITEM = ABS_ELLIPSE_ITEM + 1;
const int SWP_END_POINT_ITEM = ABS_ELLIPSE_ITEM + 2;

const int SWP_SIM_START_POINT_ITEM = ABS_ELLIPSE_ITEM + 3;
const int SWP_SIM_END_POINT_ITEM = ABS_ELLIPSE_ITEM + 4;

const int SWP_ARTIFACT_ITEM = ENTITY_ITEM + 1;
const int SWP_RESOURCE_ITEM = ENTITY_ITEM + 2;
const int SWP_WORKER_ITEM = ENTITY_ITEM + 3;

const int SWP_AGGREGATION_ITEM = CONNECTOR_ITEM + 1;
const int SWP_ASSOCIATION_ITEM = CONNECTOR_ITEM + 2;
const int SWP_COMPOSITION_ITEM = CONNECTOR_ITEM + 3;
const int SWP_DEPENDENCY_ITEM = CONNECTOR_ITEM + 4;
const int SWP_GENERALIZATION_ITEM = CONNECTOR_ITEM + 5;
const int SWP_REALIZATION_ITEM = CONNECTOR_ITEM + 6;

const int SWP_ACTIVITY_CONNECTOR_ITEM = CONNECTOR_ITEM + 7;
const int SWP_SIM_ACTIVITY_CONNECTOR_ITEM = CONNECTOR_ITEM + 8;

const int ABS_POLYGON_ITEM_USER = SWP_SIM_INTER_REGION_ITEM + 1;
const int ABS_ELLIPSE_ITEM_USER = SWP_SIM_END_POINT_ITEM + 1;
const int ABS_LINE_ITEM_USER = ABS_LINE_ITEM + 1;
const int CONNECTOR_ITEM_USER = SWP_SIM_ACTIVITY_CONNECTOR_ITEM + 1;

const qreal ABS_LINE_ZVALUE = 10000;
const qreal SWIMLANE_HANDLES_ZVALUE = 10003;
const qreal SWIMLANE_ZVALUE = -1;
const qreal SIM_MARK_ZVALUE = 10002;

const qreal SWIMLANE_MIN_WIDTH = 100;

inline bool isSwpItem(int type) {
    return type >= ABS_POLYGON_ITEM && type < ABS_RECT_ITEM + 1000;
}

inline bool isPolygonItem(int type) {
    return (type >= ABS_POLYGON_ITEM && type < ABS_POLYGON_ITEM + 1000) ||
        (type >= ENTITY_ITEM && type < ENTITY_ITEM + 1000);
}

inline bool isEllipseItem(int type) {
    return type >= ABS_ELLIPSE_ITEM && type < ABS_ELLIPSE_ITEM + 1000;
}

inline bool isLineItem(int type) {
    return type >= ABS_LINE_ITEM && type < ABS_LINE_ITEM + 1000;
}

inline bool isEntityItem(int type) {
    return type >= ENTITY_ITEM && type < ENTITY_ITEM + 1000;
}

inline bool isConnectorItem(int type) {
    return type >= CONNECTOR_ITEM && type < CONNECTOR_ITEM + 1000;
}

inline bool isConnectorHandleItem(int type) {
    return type >= CONNECTOR_HANDLE_ITEM &&
        type < CONNECTOR_HANDLE_ITEM + 1000;
}

inline bool isRectItem(int type) {
    return type >= ABS_RECT_ITEM && type < ABS_RECT_ITEM + 1000;
}

} // namespace swp

#endif
